javascript 您所在的位置:网站首页 ANY Attachments API 117 22 javascript

javascript

2024-05-10 06:17| 来源: 网络整理| 查看: 265

You need to $select and $expand the AttachmentFiles property for your list items if you want to select many items from the list.

_api/lists/getByTitle('MyList')/items?$select=AttachmentFiles,Title&$expand=AttachmentFiles

Then you can get attachment info (if it exists) in the AttachmentFiles property of your list item which will be an array of AttachmentFile objects.

I suggest you just check out the return values in your dev tools to inspect the structure with something like:

$.getJSON("/_api/lists/getByTitle('MyList')/items?$select=AttachmentFiles,Title&$expand=AttachmentFiles", function(data) { console.log(data) })

But you can do something like retrieve the file's URL with:

data.value[0].AttachmentFiles[0].ServerRelativeUrl

If your list item doesn't have any attachments, the AttachmentFiles will be an empty array.

I can't seem to get the $filter operator to work with the Attachments property to filter the results for only those items with attachments -- maybe someone else out there has some experience getting that up and running and would like to add it here =)



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有